<?php
// 判断是否登录
require_once('./inc/func/isLogin.php');
// 连接数据库
include('./inc/data/dbfunc.php');
include('./inc/data/dbparam.php');
$conn = conn_mysql();



?>

<!DOCTYPE html>
<html lang="en">


<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="./inc/pic/index/logo.ico" rel="shortcut icon" type="image/x-icon">
    <link rel="stylesheet" href="./inc/css/reset.css">
    <link rel="stylesheet" href="./inc/css/index.css">
    <link rel="stylesheet" href="./inc/css/form.css">
    <title>暨南大学-华侨最高学府-国家“双一流”建设高校</title>
</head>

<body>
    <header>
        <!-- top-nav -->
        <nav>
            <div>
                <!-- 左侧导航 -->
                <div class="left">
                    <ul>
                        <li><a href="javascript:;">报考学生</a></li>
                        <li><a href="javascript:;">在校生</a></li>
                        <li><a href="javascript:;">教职员</a></li>
                        <li><a href="javascript:;">家长|访客</a></li>
                        <li><a href="javascript:;">校友</a></li>
                    </ul>
                </div>
                <!-- 右侧导航 -->
                <div class="right">
                    <ul>
                        <li><a href=<?=isset($_COOKIE['uName']) ? './logout.php' : './login.php' ?>><?=isset($_COOKIE['uName']) ? '退出登录' : '登录' ?></a></li>
                        <li><a href="javascript:;">邮件</a></li>
                        <li><a href="javascript:;">通知</a></li>
                        <li><a href="javascript:;">会议</a></li>
                        <li><a href="javascript:;">网上服务大厅</a></li>
                        <li>|</li>
                        <li><a href="javascript:;">图书馆</a></li>
                        <li>|</li>
                        <li><a href="javascript:;">English<span></span></a></li>
                        <li><a href="javascript:;" title="搜索"></a></li>
                    </ul>
                </div>
            </div>
        </nav>
        <!-- logo -->
        <div class="logo">
            <div>
                <a href="javascript:;" title="暨南大学"><img src="./inc/pic/index/logo2.svg" alt=""></a>
            </div>
        </div>
    </header>

    <!-- 菜单 -->
    <div id="menu-bar">
        <div id="menu">
            <ul class="nav">
                <li><a href="javascript:;">学校概况</a></li>
                <li><a href="javascript:;">组织机构</a></li>
                <li><a href="/TeacherStuSys/school/stuForm.php">学生录入</a></li>
                <li><a href="javascript:;">教师成绩录入</a></li>
                <li><a href="./school/tTask.php">教学任务查询</a></li>
                <li><a href="javascript:;">用户设置</a></li>
                <!-- 小船 -->
                <li><div id="ship"><img src="./inc/pic/index/top_ship.png" alt=""></div></li>
                
            </ul>
            <!-- 二级菜单 -->
            <div id="inside-menu">
                <div>

                    <!-- 左侧背景图片 -->
                    <div class="bg-color">

                    </div>
                    <!-- 右侧二级菜单 -->
                    <div class="inside-right">
                        <div class="img">
                            <img src="./inc/pic/index/zh.png" alt="">
                        </div>
                        <ul>
                            <li>学校简介</li>
                            <li>领导致辞</li>
                            <li>董事会</li>
                            <li>现任领导</li>
                            <li>大学章程</li>
                            <li>校训、校徽、校歌</li>
                            <li>暨南精神</li>
                            <li>学校风景</li>
                        </ul>
                        <ul>
                            <li>管理服务</li>
                            <li>院系设置</li>
                            <li>珠海校区</li>
                            <li>番禺校区</li>
                            <li>深圳校区</li>
                        </ul>
                        <ul>
                            <li>教师队伍</li>
                            <li>研究生教育</li>
                            <li>本科生教育</li>
                            <li>继续教育</li>
                            <li>华文教育</li>
                            <li>专业学位</li>
                            <li>创新创业教育</li>
                        </ul>
                        <ul>
                            <li>科研机构</li>
                            <li>学科建设</li>
                            <li>学术期刊</li>
                            <li>成果荟萃</li>
                        </ul>
                        <ul>
                            <li>国际交流</li>
                            <li>对外联络</li>
                            <li>校友会</li>
                        </ul>
                        <ul>
                            <li><a href="./school/portrait.php">设置头像</a></li>
                            <li>生活服务</li>
                            <li>学生管理</li>
                            <li>学生发展</li>
                            <li>学生活动</li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- 主要内容 -->
    <main class="main-head">
        <div class="user-info">
            <img src="<?=$_COOKIE['uImg']?>" alt="" class="user-icon">
            <span>您好!</span>
            <span><?=$_COOKIE['uName']?></span>
            <span>
                <?php 
                echo($_COOKIE['role'] == '0' ? "学号: {$_COOKIE['uId']}" : "工号:{$_COOKIE['uId']}");
                ?>
            </span>
            <span>系: <?=$_COOKIE['uDep']?></span>
        </div>

        <!-- 查询条件 -->
        <div id="selects">
            <!-- 按班级选择 -->
            <div id="select-class">
                请选择班级：
                <select name="class" id="huangcz_class">
                    <?php
                    $sql = "select cl_name, cl_id 
                            from huangcz_class";
                    
                    $res = $conn->query($sql);
                    while ($row = $res->fetch_assoc()){
                        echo(
                            <<<html
                            <option value="{$row['cl_id']}">{$row['cl_name']}</option>
                        html);
                    }
                    ?>
                </select>
                <button>查询</button>
            </div>
            
        <!-- 表格 -->
        <table class="table">
            <thead>
                <tr>
                    <th>序号</th>
                    <th>班级</th>
                    <th>学号</th>
                    <th>姓名</th>
                    <th>二级学院</th>
                </tr>
            </thead>
            <tbody>
                <?php
                // 设置连接字符串
                $sql = "select stu_id, stu_name, stu_class, cl_name
                        from huangcz_stu, huangcz_class
                        where huangcz_stu.stu_class=huangcz_class.cl_id
                        limit 10";

                // 执行查询
                $res = $conn->query($sql);
                for ($num = 1; $num <= $res->num_rows; $num++){
                    
                    // 获取查询结果
                    $row = $res->fetch_assoc();
                    echo(
                        <<<html
                        <tr>
                            <td>{$num}</td>
                            <td>{$row['cl_name']}</td>
                            <td>{$row['stu_id']}</td>
                            <td>{$row['stu_name']}</td>
                            <td>计算机学院</td>
                        </tr>
                    html
                    );
                }
                ?>
            </tbody>
        </table>

    </main>


    <!-- 底部 -->
    <footer id="footer">
        <div class="content">
            <!-- 左侧 -->
            <div class="left">
                <ul>
                    <li> <a href="javascript:;">学校概况</a> </li>
                    <li> <a href="javascript:;">组织机构</a> </li>
                    <li><a href="javascript:;">招生就业</a></li>
                    <li><a href="javascript:;">人才培养</a></li>
                </ul>
                <ul>
                    <li><a href="javascript:;">人才招聘</a></li>
                    <li><a href="javascript:;">科学研究</a></li>
                    <li><a href="javascript:;">合作交流</a></li>
                    <li><a href="javascript:;">综合服务</a></li>
                </ul>
            </div>

            <!-- 中间 -->
            <div class="center">
                <div class="wx">
                    <div> <img src="./inc/pic/index/ewm2.jpg" alt=""> <p>官方微信订阅号</p> </div>
                    <div> <img src="./inc/pic/index/ewm.png" alt=""> <p>官方微信服务号</p></div>
                </div>
                <div class="info">
                    <ul>
                        <li>地址：中国 广州市 黄埔大道西601号</li>
                        <li>邮编: 510632</li>
                        <li>主页: https://www.jnu.edu.cn</li>
                        <li>版权所有©暨南大学</li>
                        <li>ICP备案号: 粤ICP备 12087612号</li>
                        <li>粤公网安备 44010602001461号</li>
                    </ul>
                </div>
            </div>

            <!-- 右侧 -->
            <div class="right">
                <a href="javascript:;" title="logo"><img src="./inc/pic/index/logo_2.png" alt=""></a>
                <div>
                    <a href="javascript:;" title="conac"><img src="./inc/pic/index/blue.png" alt=""></a>
                    <a href="javascript:;" title="weixin"><img src="./inc/pic/index/wb.png" alt=""></a>
                    <a href="javascript:;" title="weixin"><img src="./inc/pic/index/wx.png" alt=""></a>
                </div>
            </div>
        </div>
    </footer>
</body>

<script src="./inc/js/jquery-3.6.0.min.js"></script>
<script src="./inc/js/index.js"></script>

</html>